{include 'public/header.html'}  

  <div class="main-content">
    <div class="page-content">
      <div class="page-content-area" style="opacity: 0.8;"> <br>
        <div class="page-header">
          <h1> 设备管理 <small><i class="ace-icon fa fa-angle-double-right"></i> 设备列表 </small> </h1>
        </div>
        <div class="row">
          <div class="col-xs-12">
             <form method="post" class="form-horizontal" role="form" id="submitform" onsubmit="return false">
              <table class="table table-bordered table-hover">
                <thead>
                  <tr>
                    <th>ID</th>
                    <th>设备</th>
                    <th>备注</th>
                    <th>时间</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                {foreach $list.data as $v}
                  <tr>
                    <td><input type="checkbox" name="id[]" value="{$v['id']}"/>
                      {$v['id']}</td>
                    <td>{$v['device_id']}</td>
                    <td>{$v['info']}</td>
                    <td>{$v['banktime']}</td>
                    <td><a href="{siteurl('con=admin/device/edit')}&id={$v['id']}">编辑</a></td>
                </tr>
                {/foreach}
                <tr>
                    <td colspan="7"><input type="checkbox" onclick="var ck = this.checked;$('input[name=&quot;id[]&quot;]').each(function(){ this.checked = ck });">
                      <a class="btn btn-default btn-delete">删除</a>
                      <a class="btn btn-success" href="{siteurl('con=admin/device/edit')}">+ 新增设备</a></td>
                  </tr>
                </tbody>
              </table>
              <table style="width:100%;" class="listpage">
                <tr>
                  <td>{showpage($list.page)}</td>
                </tr>
              </table>
             </form>
          </div>
        </div>
    </div>
  </div>
  
<script>
$(function(){
	$('.btn-delete').click(function(){
		var ckvals = $.selectCK('input[name="id[]"]');
		if(!ckvals){
			tooltipbox.show('请选择要操作的数据');
			return false;
		}
		tooltipbox.confirm('确定永久删除选中的数据？', function(data){
			tooltipbox.show('正在执行操作...');
			$.post('{siteurl("con=admin/device/delete")}', data, function(res){
				if(res.code == 1){
					location.reload();
				}
				tooltipbox.show(res.msg);
			}, 'json').error(function(){
				tooltipbox.show('数据或网络错误');
			});
		}, false, { 'ids': ckvals });
	});
});
</script>  
{include 'public/footer.html'}  